package com.data.center.dictionary;

import com.data.center.exception.exception.BizException;
import com.data.center.exception.info.CommonEnum;

/**
 * @author DN
 * @description:学科分类代码映射枚举类CD000040
 * @date 2023/11/30 18:00
 */
public enum AcademicDiscipline implements KeyValueMap {
    MATHEMATICS("110", "数学"),
    INFORMATION_SCIENCE_AND_SYSTEM_SCIENCE("120", "信息科学与系统科学"),
    MECHANICS("130", "力学"),
    PHYSICS("140", "物理学"),
    CHEMISTRY("150", "化学"),
    ASTRONOMY("160", "天文学"),
    EARTH_SCIENCE("170", "地球科学"),
    BIOLOGY("180", "生物学"),
    PSYCHOLOGY("190", "心理学"),
    AGRICULTURE("210", "农学"),
    FORESTRY("220", "林学"),
    ANIMAL_HUSBANDRY_AND_VETERINARY_SCIENCE("230", "畜牧、兽医科学"),
    FISHERIES("240", "水产学"),
    BASIC_MEDICAL_SCIENCE("310", "基础医学"),
    CLINICAL_MEDICINE("320", "临床医学"),
    PREVENTIVE_MEDICINE_AND_PUBLIC_HEALTH("330", "预防医学与公共卫生学"),
    MILITARY_MEDICINE_AND_SPECIAL_MEDICINE("340", "军事医学与特种医学"),
    PHARMACY("350", "药学"),
    TRADITIONAL_CHINESE_MEDICINE_AND_CHINESE_PHARMACY("360", "中医药与中药学"),
    ENGINEERING_AND_TECHNOLOGICAL_SCIENCE_BASIC_DISCIPLINE("410", "工程与技术科学基础学科"),
    INFORMATION_AND_SYSTEM_SCIENCE_RELATED_ENGINEERING_AND_TECHNOLOGY("413", "信息与系统科学相关工程与技术"),
    NATURAL_SCIENCE_RELATED_ENGINEERING_AND_TECHNOLOGY("416", "自然科学相关工程与技术"),
    SURVEYING_SCIENCE_AND_TECHNOLOGY("420", "测绘科学技术"),
    MATERIAL_SCIENCE("430", "材料科学"),
    MINING_ENGINEERING_TECHNOLOGY("440", "矿山工程技术"),
    METALLURGICAL_ENGINEERING_TECHNOLOGY("450", "冶金工程技术"),
    MECHANICAL_ENGINEERING("460", "机械工程"),
    POWER_AND_ELECTRICAL_ENGINEERING("470", "动力与电气工程"),
    ENERGY_SCIENCE_AND_TECHNOLOGY("480", "能源科学技术"),
    NUCLEAR_SCIENCE_AND_TECHNOLOGY("490", "核科学技术"),
    ELECTRONICS_AND_COMMUNICATION_TECHNOLOGY("510", "电子与通信技术"),
    COMPUTER_SCIENCE_AND_TECHNOLOGY("520", "计算机科学技术"),
    CHEMICAL_ENGINEERING("530", "化学工程"),
    PRODUCT_APPLICATION_RELATED_ENGINEERING_AND_TECHNOLOGY("535", "产品应用相关工程与技术"),
    TEXTILE_SCIENCE_AND_TECHNOLOGY("540", "纺织科学技术"),
    FOOD_SCIENCE_AND_TECHNOLOGY("550", "食品科学技术"),
    CIVIL_ARCHITECTURAL_ENGINEERING("560", "土木建筑工程"),
    WATER_CONSERVANCY_ENGINEERING("570", "水利工程"),
    TRANSPORTATION_ENGINEERING("580", "交通运输工程"),
    AVIATION_AEROSPACE_SCIENCE_AND_TECHNOLOGY("590", "航空、航天科学技术"),
    ENVIRONMENTAL_SCIENCE_AND_TECHNOLOGY_AND_RESOURCE_SCIENCE_AND_TECHNOLOGY("610", "环境科学技术及资源科学技术"),
    SAFETY_SCIENCE_AND_TECHNOLOGY("620", "安全科学技术"),
    MANAGEMENT_SCIENCE("630", "管理学"),
    MARXISM("710", "马克思主义"),
    PHILOSOPHY("720", "哲学"),
    RELIGIOUS_STUDIES("730", "宗教学"),
    LINGUISTICS("740", "语言学"),
    LITERATURE("750", "文学"),
    ART_SCIENCE("760", "艺术学"),
    HISTORY("770", "历史学"),
    ARCHAEOLOGY("780", "考古学"),
    ECONOMICS("790", "经济学"),
    POLITICAL_SCIENCE("810", "政治学"),
    LAW("820", "法学"),
    MILITARY_SCIENCE("830", "军事学"),
    SOCIOLOGY("840", "社会学"),
    ETHNOLOGY_AND_CULTURAL_STUDIES("850", "民族学与文化学"),
    JOURNALISM_AND_COMMUNICATION_STUDIES("860", "新闻学与传播学"),
    LIBRARY_INFORMATION_AND_ARCHIVE_STUDIES("870", "图书馆、情报与文献学"),
    EDUCATION("880", "教育学"),
    SPORTS_SCIENCE("890", "体育科学"),
    STATISTICS("910", "统计学");

    private String code;
    private String name;

    AcademicDiscipline(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public String getKey() {
        return code;
    }

    @Override
    public String getValue() {
        return name;
    }

    public static AcademicDiscipline getValueByKey(String key) {
        for (AcademicDiscipline academicDiscipline : values()) {
            if (academicDiscipline.code.equals(key)) {
                return academicDiscipline;
            }
        }
        throw new BizException(CommonEnum.CAN_NOT_FIND_IN_DICTIONARY);
    }

    public static AcademicDiscipline getKeyByValue(String value) {
        for (AcademicDiscipline academicDiscipline : values()) {
            if (academicDiscipline.name.equals(value)) {
                return academicDiscipline;
            }
        }
        throw new BizException(CommonEnum.CAN_NOT_FIND_IN_DICTIONARY);
    }
}
